package {
	import flash.events.MouseEvent;
	import flash.text.TextFormat;
	import flash.text.TextField;

	public class ScreenEndGame extends Screen2 {
		private var end:TextField;
		private var endFormat:TextFormat = new TextFormat();
		private var btnPlay:Button;
		private var scoreFormat:TextFormat = new TextFormat();
		private var coinInfo:TextField = new TextField();
		private var timeInfo:TextField = new TextField();
		private var screengame:ScreenGame = new ScreenGame();
		
		public function ScreenEndGame() {
			setFormat();
			addWinText();
//			addScoresText();
			addButton();
		}
		private function onBtnPlayClick(event:MouseEvent):void{
			laberintoapp.gotoScreen("main");
		}
		private function setFormat():void{
			endFormat.color=0xFFFFFF;
			endFormat.size = 100;
			endFormat.align = 'center';
			endFormat.font = 'Comic sans MS';
		}
		private function addWinText():void{
			end = new TextField();
			end.defaultTextFormat = endFormat;
			end.text = 'Ganaste!';
			end.x = 200;
			end.y = 100;
			end.width = 400;
			end.height = 300;
			addChild(end);
		}
		private function addButton():void{
			btnPlay = new Button();
			addChild(btnPlay);
			btnPlay.textButtom.text = 'Juega de nuevo';
			btnPlay.x = 410;
			btnPlay.y = 350;
			btnPlay.addEventListener(MouseEvent.CLICK, onBtnPlayClick);
		}
//		private function addScoresText():void{
//			setScoresFormat();
//			coinInfo.defaultTextFormat = scoreFormat;
//			coinInfo.text = 'Monedas obtenidas: ' + countCoins;
//			coinInfo.x = 200;
//			coinInfo.width = 200;
//			addChild(coinInfo);
//		}
		private function setScoresFormat():void{
			scoreFormat.color=0xFFFFFF;
			scoreFormat.size = 16;
			scoreFormat.align = 'center';
			scoreFormat.font = 'Comic sans MS';
		}
	}
}
